package root.electronclass.electronclass.ext;

import androidx.lifecycle.MutableLiveData;

/**
 * @author Lokiy
 * @date 2023/2/19 19:08
 */
public class NotifyWhenChangeLiveData<T> extends MutableLiveData<T> {

    public NotifyWhenChangeLiveData() {
        super();
    }

    public NotifyWhenChangeLiveData(T value) {
        super(value);
    }

    @Override
    public void setValue(T value) {
        if (value != getValue()) {
            super.setValue(value);
        }
    }

    @Override
    public void postValue(T value) {
        if (value != getValue()) {
            super.postValue(value);
        }
    }
}
